/**
 * Created by Administrator on 2017/1/11.
 */
import {Component,OnInit} from "@angular/core";
import {Router,ActivatedRoute} from "@angular/router";
import {KSSwiperContainer, KSSwiperSlide}    from 'angular2-swiper';
import  { SecondService } from "../service/second.service";
@Component({
  selector:"second-news",
  templateUrl:"./new.html",
  styleUrls:["./news.less"],
  providers:[SecondService]
})

export class SecondNewsComponent implements OnInit{
  secondInfoData : any;
  type : String;
  constructor(private router:Router,private ar:ActivatedRoute,private secondService:SecondService){}

  ngOnInit(){
    // this can change the params by other ....
    //var type = this.router.currentUrlTree ? this.router.currentUrlTree.queryParams.type : "lol";
    console.log("news tab , ",this.ar.snapshot.queryParams);
    this.type = this.ar.snapshot.queryParams["type"] ? this.ar.snapshot.queryParams["type"] : "lol";
    this.secondInfoData = this.secondService.getInfoData(this.type).subscribe(res=>this.secondInfoData = res);
  }
}
